#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef double db;

#define in read()
#define pii pair<int,int>
#define fi first
#define se second
#define FILE(x) freopen(x".in","r",stdin);\
	freopen(x".out","w",stdout);
#define pb push_back

int read(){
	int x = 0,sgn = 1;char ch = getchar();
	for(;!isdigit(ch);ch = getchar()) if(ch == '-') sgn = -1;
	for(;isdigit(ch);ch = getchar()) x = (x<<1)+(x<<3)+(ch^48);
	return x*sgn;
}

const int mod = 1e9+9;
const int N = 2010;

ll dp[N][N],fac[N],inv[N],f[N];
int a[N],b[N],n,m,k;

ll qp(ll x,int t){ll res=1;for(;t;t>>=1,x=x*x%mod)if(t&1)res=res*x%mod;return res;}

ll C(int x,int y){return fac[x] * inv[y] % mod * inv[x-y] % mod;}

int main (){
#ifndef ONLINE_JUDGE
	freopen("1.in","r",stdin);
#endif
	n = in,k = in; if((k & 1) ^ (n & 1)) return puts("0"),0;
	m = (n + k) >> 1;
	for(int i = 1;i <= n;i++) a[i] = in;
	for(int i = 1;i <= n;i++) b[i] = in;
	sort(a+1,a+n+1); sort(b+1,b+n+1);
	for(int i = (fac[0] = 1);i <= n;i++) fac[i] = fac[i-1] * i % mod; inv[n] = qp(fac[n],mod-2);
	for(int i = n-1;i >= 0;i--) inv[i] = inv[i+1] * (i + 1) % mod;
	dp[0][0] = 1;
	for(int i = 1,cnt = 1;i <= n;i++){
		while(a[i] > b[cnt] && cnt <= n) cnt++; dp[i][0] = 1;
		for(int j = 1;j <= cnt;j++){
			dp[i][j] = (dp[i-1][j] + dp[i-1][j-1] * (cnt - j) % mod) % mod;
		}
	}
	for(int i = m;i <= n;i++) f[i] = dp[n][i] * fac[n-i] % mod;
	ll ans = 0;
	for(int i = m;i <= n;i++) ans = (ans + ((i - m) & 1 ? -1 : 1) * C(i,m) % mod * f[i] % mod + mod) % mod;
	printf("%lld\n",ans % mod);
	return 0;
}

